from flask import render_template, Blueprint, request, session

login_blue = Blueprint('login', __name__)  # 创建一个蓝图

@login_blue.route('/', methods=['GET'])
@login_blue.route('/login', methods=['GET'])
def tologin():  # put application's code here
    return render_template('login.html')


@login_blue.route('/dologin', methods=['POST'])
def login():  # put application's code here
    result = request.form
    print(result.get('name'))
    print(result.get('pass'))
    session['username'] = result.get('name')
    return render_template('index.html', name=result.get('name'))

# 钩子函数 before_request

